﻿using System.ComponentModel.Composition;
using IdeaBlade.Application.Framework.Core.DesignTimeSupport;

namespace CoProjectModel
{
    [Export(typeof(ISampleDataProvider<CoProjectEntities>))]
    public class SampleDataProvider : ISampleDataProvider<CoProjectEntities>
    {
        private readonly ISampleDataLoader _sampleDataLoader;

        [ImportingConstructor]
        public SampleDataProvider(ISampleDataLoader sampleDataLoader)
        {
            _sampleDataLoader = sampleDataLoader;
        }

        #region ISampleDataProvider<NorthwindIBEntities> Members

        public void AddSampleData(CoProjectEntities manager)
        {
            manager.CacheStateManager.RestoreCacheState(_sampleDataLoader.SampleData);
        }

        #endregion
    }
}